package storage.beans;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import common.Constants;

public class SimulationBean {
  private int tilt;
  private float eccentricity;
  private int precision;
  private int samplingRate;
  private int temporalAccuracy;
  private int gridSpacing = Constants.DEFAULT_GRID_SPACING; //in degrees 
  private int timeStep = Constants.DEFAULT_SIM_TIME_STEP; //in minutes
  private long startDateTime;
  private long endDateTime;
  private int radius;
  private Map gridSnapshots;
  private Iterator gridIterator;
  
  public SimulationBean() {
    gridSnapshots = new HashMap();
  }
  
  /**
   * Initializes an iterator over the set of GridBean objects contained in this bean.
   */
  public void initGridIterator() {
    gridIterator = gridSnapshots.keySet().iterator();
  }
  
  /**
   * SimulationBean.initGridIterator() should be called before calling this for the first time.
   * @return null if there are no more GridBean objects to return
   */
  public GridBean getNextGrid() {
    if(gridIterator.hasNext())
      return (GridBean)gridSnapshots.get(gridIterator.next());
    else
      return null;
  }

  public void addSnapshot(GridBean grid) {
    String key = String.valueOf(grid.getDateTime());
    gridSnapshots.put(key, grid);
  }
  
  public void setPrecision(int precision) {
    this.precision = precision;
  }
  
  public void setSamplingRate(int samplingRate) {
    this.samplingRate = samplingRate;
  }
  
  public void setTemporalAccuracy(int temporalAccuracy) {
    this.temporalAccuracy = temporalAccuracy;
  }
  
  public int getRadius() {
    return radius;
  }
  
  public void setRadius(int radius) {
    this.radius = radius;
  }

  public float getEccentricity() {
    return eccentricity;
  }

  public void setEccentricity(float eccentricity) {
    this.eccentricity = eccentricity;
  }

  public long getEndDateTime() {
    return endDateTime;
  }

  public void setEndDateTime(long endDateTime) {
    this.endDateTime = endDateTime;
  }

  public int getGridSpacing() {
    return gridSpacing;
  }

  public void setGridSpacing(int gridSpacing) {
    this.gridSpacing = gridSpacing;
  }

  public int getPrecision() {
    return precision;
  }

  public int getSamplingRate() {
    return samplingRate;
  }

  public long getStartDateTime() {
    return startDateTime;
  }

  public void setStartDateTime(long startDateTime) {
    this.startDateTime = startDateTime;
  }

  public int getTemporalAccuracy() {
    return temporalAccuracy;
  }

  public int getTilt() {
    return tilt;
  }

  public void setTilt(int tilt) {
    this.tilt = tilt;
  }

  public int getTimeStep() {
    return timeStep;
  }

  public void setTimeStep(int timeStep) {
    this.timeStep = timeStep;
  }

}
